package grpc

import (
	"github.com/goravel/framework/facades"

	"goravel/app/models"
)

type User interface {
	Create() (models.User, error)
}

type UserImpl struct {
}

func NewUserImpl() *UserImpl {
	return &UserImpl{}
}

func (r *UserImpl) Create() (models.User, error) {
	user := models.User{
		Mobile:   "12345678901",
		Password: "123456",
		Configurations: []models.Configuration{
			{
				ServerName: "test",
				ServerPort: "1234",
				Host:       "12.12.12.12",
				Port:       "1234",
				Username:   "test",
				Password:   "123456",
				Type:       "ftp",
				UserID:     1,
				Active:     1,
			},
		},
	}
	if err := facades.Orm().Query().Create(&user); err != nil {
		return user, err
	}

	return user, nil
}
